import { configure, makeAutoObservable } from 'mobx';
import { ReportEntity } from '@/entities/ReportEntity';

configure({
  enforceActions: 'always'
});

class ReportStore {
  constructor() {
    makeAutoObservable(this, {}, {autoBind: true});
  }

  /**
   * 租客的全部报修列表
   */
  tenantReportList: any | ReportEntity.IReport[] = [];

  /**
   * 房东的房屋报修（租客的报修）
   */
  landlordReportList: any | ReportEntity.IReport[] = [];

  /**
   * 设置租客的全部报修列表
   * @param tenantReportList
   */
  setTenantReportList(tenantReportList: ReportEntity.IReport[]) {
    this.tenantReportList = tenantReportList;
  }

  /**
   * 清除租客的全部报修列表
   */
  clearTenantReportList() {
    this.tenantReportList = null;
  }

  /**
   * 设置房东的房屋报修（租客的报修）
   */
  setLandlordReportList(landlordReportList: ReportEntity.IReport) {
    this.landlordReportList = landlordReportList;
  }

  /**
   * 清除房东的房屋报修（租客的报修）
   */
  clearLandlordReportList() {
    this.landlordReportList = null;
  }
}


const reportStore = new ReportStore();

export default reportStore;